package com.jzt.test;

import com.yvan.leto.LetoManage;
import com.yvan.leto.LogbackListener;
import com.yvan.leto.SpringBootListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class RootController {

    @Autowired
    private UserAgentMapper userAgentMapper;

    @Autowired
    private TestProperties testProperties;

    @Autowired
    private LogbackListener logbackListener;

    @Autowired
    private SpringBootListener springBootListener;

    @GetMapping("/ok")
    public String ok() {
        return "ok";
    }

    @GetMapping("/config/sb")
    public Object configSb() {
        return springBootListener.getSpringBootMap();
    }

    @GetMapping(value = "/config/lb", produces = "application/xml")
    @ResponseBody
    public String configLb() {
        return logbackListener.getLogbackConfigContent();
    }

    @GetMapping("/")
    public Object index() {
        //PageHelper.startPage(2, 10);
        //val ret1 = userAgentMapper.updateUserAgentEnable();
        //val ret2 = userAgentMapper.updateUserAgentDisable();
        //val ret3 = userAgentMapper.getAllUserAgent(Maps.newLinkedHashMap());
        //val ret4 = userAgentMapper.getAllUserAgent(Maps.newLinkedHashMap());
        //return Lists.newArrayList(ret1, ret2, ret3, ret4);
        return testProperties;
    }

}
